From df6b0cb8449812e7fb200bc852107fa7eb708496 Mon Sep 17 00:00:00 2001 From: Justin Burkett Date: Wed, 12 Jul 2023 17:51:08 -0400 Subject: [PATCH] Add which-key-C-h-map-prompt to make it customizable Fixes #350 --- which-key.el | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/which-key.el b/which-key.el index f7c4f160625..25f2397a9a8 100644 --- a/which-key.el +++ b/which-key.el @@ -437,6 +437,25 @@ Only takken into account when popup type is side-window." 'which-key :type 'boolean) +(defvar which-key-C-h-map-prompt + (concat " \\" + " \\[which-key-show-next-page-cycle]" + which-key-separator "next-page," + " \\[which-key-show-previous-page-cycle]" + which-key-separator "previous-page," + " \\[which-key-undo-key]" + which-key-separator "undo-key," + " \\[which-key-toggle-docstrings]" + which-key-separator "toggle-docstrings," + " \\[which-key-show-standard-help]" + which-key-separator "help," + " \\[which-key-abort]" + which-key-separator "abort" + " 1..9" + which-key-separator "digit-arg") + "Prompt to display when invoking `which-key-C-h-map'. This string +is fed into `substitute-command-keys'") + (defvar which-key-C-h-map (let ((map (make-sparse-keymap))) (dolist (bind `(("\C-a" . which-key-abort) @@ -2419,22 +2438,7 @@ prefix) if `which-key-use-C-h-commands' is non nil." full-prefix (which-key--propertize (substitute-command-keys - (concat - " \\" - " \\[which-key-show-next-page-cycle]" - which-key-separator "next-page," - " \\[which-key-show-previous-page-cycle]" - which-key-separator "previous-page," - " \\[which-key-undo-key]" - which-key-separator "undo-key," - " \\[which-key-toggle-docstrings]" - which-key-separator "toggle-docstrings," - " \\[which-key-show-standard-help]" - which-key-separator "help," - " \\[which-key-abort]" - which-key-separator "abort" - " 1..9" - which-key-separator "digit-arg")) + which-key-C-h-map-prompt) 'face 'which-key-note-face))) (key (let ((key (read-key prompt))) (if (numberp key) -- 2.30.2